#include "mainwindow.h"
#include "ui_mainwindow.h"

#include "can_alyst_ii.h"

#include <QDebug>
#include <QThread>
#include <QTimer>

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    can_alyst = new can_alyst_ii();

    can_alyst_thread = new QThread(this);

    /* 把can_alayst转为线程 */
    can_alyst->moveToThread(can_alyst_thread);

    /* 线程启动 */
    can_alyst_thread->start();

    /* 点击发送消息 */
    connect(ui->write_push_button, SIGNAL(clicked()), this, SLOT(can_transmit_clicked()));

    /* 收到消息处理 */
    connect(can_alyst, &can_alyst_ii::ch1_receive_msg_signals, this, &MainWindow::can_receive_ch1_msg_process);
    connect(can_alyst, &can_alyst_ii::ch2_receive_msg_signals, this, &MainWindow::can_receive_ch2_msg_process);

    /* 点击 打开设备 */
    connect(ui->device_setting_open_push_button, SIGNAL(clicked()), this, SLOT(can_open_clicked()));

    /* 点击 关闭设备 */
    connect(ui->device_setting_close_push_button, SIGNAL(clicked()), this, SLOT(can_close_clicked()));

    /* 点击 初始化通道 */
    connect(ui->channel_setting_init_push_button, SIGNAL(clicked()), this, SLOT(can_channel_init_clicked()));

    /* 点击 打开通道 */
    connect(ui->channel_setting_push_button, SIGNAL(clicked()), this, SLOT(can_channel_start_clicked()));

    /* 点击 参数设置 */
    connect(ui->receive_set_read_channel_push_button, SIGNAL(clicked()), this, SLOT(can_parameter_config_set_clicked()));

    /* 点击 恢复初始参数 */
    connect(ui->receive_recover_read_channel_push_button, SIGNAL(clicked()), this, SLOT(can_parameter_config_base_clicked()));

    /* 点击 滤波校验方式三个其中一个 */
    connect(ui->receive_write_radio_button, SIGNAL(clicked()), this, SLOT(can_receive_select_clicked()));
    connect(ui->receive_std_radio_button, SIGNAL(clicked()), this, SLOT(can_receive_select_clicked()));
    connect(ui->receive_ext_radio_button, SIGNAL(clicked()), this, SLOT(can_receive_select_clicked()));

    /* 自定义滤波编辑完成 */
    connect(ui->receive_acc_code_line_edit, SIGNAL(editingFinished()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_line_edit, SIGNAL(editingFinished()), this, SLOT(can_receive_change_clicked()));

    /* 点击 滤波勾选框 */
    connect(ui->receive_acc_code_std_bit0_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_std_bit1_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_std_bit2_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_std_bit3_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_std_bit4_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_std_bit5_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_std_bit6_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_std_bit7_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_std_bit8_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_std_bit9_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_std_bit10_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));

    connect(ui->receive_acc_mask_std_bit0_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_std_bit1_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_std_bit2_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_std_bit3_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_std_bit4_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_std_bit5_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_std_bit6_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_std_bit7_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_std_bit8_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_std_bit9_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_std_bit10_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));

    connect(ui->receive_acc_code_ext_bit0_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit1_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit2_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit3_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit4_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit5_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit6_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit7_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit8_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit9_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit10_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit11_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit12_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit13_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit14_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit15_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit16_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit17_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit18_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit19_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit20_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit21_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit22_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit23_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit24_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit25_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit26_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit27_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_code_ext_bit28_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));

    connect(ui->receive_acc_mask_ext_bit0_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit1_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit2_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit3_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit4_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit5_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit6_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit7_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit8_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit9_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit10_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit11_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit12_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit13_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit14_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit15_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit16_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit17_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit18_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit19_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit20_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit21_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit22_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit23_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit24_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit25_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit26_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit27_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
    connect(ui->receive_acc_mask_ext_bit28_check_box, SIGNAL(clicked()), this, SLOT(can_receive_change_clicked()));
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::can_board_info_get(void)
{
    /* 获取设备信息 */

    can_alyst->read_board_info();

    /* 设备信息显示 */

    ui->device_msg_status_label->setText("打开");

    ui->device_msg_channel_num_label->setText(QString::number(can_alyst->vci_board_info.can_Num));

    ui->device_msg_str_hw_type_label->setText(can_alyst->vci_board_info.str_hw_Type);

    ui->device_msg_str_serial_num_label->setText(can_alyst->vci_board_info.str_Serial_Num);

    ui->device_msg_hw_ver_label->setText(QString::number(can_alyst->vci_board_info.hw_Version));

    ui->device_msg_dr_ver_label->setText(QString::number(can_alyst->vci_board_info.dr_Version));

    ui->device_msg_fw_ver_label->setText(QString::number(can_alyst->vci_board_info.fw_Version));

    ui->device_msg_in_ver_label->setText(QString::number(can_alyst->vci_board_info.in_Version));

}

void MainWindow::can_board_info_base(void)
{
    ui->device_msg_status_label->setText("关闭");

    ui->device_msg_channel_num_label->setText("--");

    ui->device_msg_str_hw_type_label->setText("--");

    ui->device_msg_str_serial_num_label->setText("--");

    ui->device_msg_hw_ver_label->setText("--");

    ui->device_msg_dr_ver_label->setText("--");

    ui->device_msg_fw_ver_label->setText("--");

    ui->device_msg_in_ver_label->setText("--");
}

void MainWindow::can_open_clicked(void)
{
    /* ==== 主界面按下打开设备按钮 ==== */

    /* 设备类型 */

    switch(ui->device_setting_type_combo_box->currentIndex())
    {
        case 0:
        {
            can_alyst->device_type = VCI_USBCAN2;
            break;
        }
    }

    /* 设备索引 */

    can_alyst->device_index = ui->device_setting_type_combo_box->currentIndex();

    /* 打开设备 */

    can_alyst->open_device();

    /* 获取设备信息 */

    can_board_info_get();

    /* 按钮状态设置 */

    ui->device_setting_open_push_button->setEnabled(false);
    ui->device_setting_close_push_button->setEnabled(true);
}

void MainWindow::can_close_clicked(void)
{
    /* ==== 主界面按下关闭设备按钮 ==== */

    /* 设备类型 */

    switch(ui->device_setting_type_combo_box->currentIndex())
    {
        case 0:
        {
            can_alyst->device_type = VCI_USBCAN2;

            break;
        }
        default:
        {
            break;
        }
    }

    /* 设备索引 */

    can_alyst->device_index = ui->device_setting_type_combo_box->currentIndex();

    /* 关闭设备 */

    can_alyst->close_device();

    /* 设备信息恢复 */

    can_board_info_base();

    /* 按钮状态设置 */

    ui->device_setting_open_push_button->setEnabled(true);
    ui->device_setting_close_push_button->setEnabled(false);
}

void MainWindow::can_channel_init_clicked(void)
{
    can_alyst_ii::can_alyst_ii::channel_t ch;

    /* 获取通道编号 */

    ch = (can_alyst_ii::can_alyst_ii::channel_t)ui->channel_combo_box->currentIndex();

    /* 通道初始化 */

    can_alyst->channel_init(ch);

    /* 清除缓存 */

    can_alyst->clear_buffer(ch);
}

void MainWindow::can_channel_start_clicked(void)
{
    can_alyst_ii::can_alyst_ii::channel_t ch;

    /* 获取通道编号 */

    ch = (can_alyst_ii::can_alyst_ii::channel_t)ui->channel_combo_box->currentIndex();

    /* 打开通道 */

    can_alyst->channel_start(ch);
}

void MainWindow::can_parameter_config_set_clicked(void)
{
    can_alyst_ii::channel_t ch;

    bool ok;

    /* 获取通道编号 */

    ch = (can_alyst_ii::channel_t)ui->receive_channel_combo_box->currentIndex();

    /* 设置波特率 */

    can_alyst->parameter_config[(int)ch].baudrate = ui->receive_baudrate_combo_box->currentText().remove("Kbps");

    /* 验收码设置 */

    can_alyst->parameter_config[(int)ch].acc_code = ui->receive_acc_code_line_edit->text().remove("0x").toULong(&ok, 16);

    /* 屏蔽码设置 */

    can_alyst->parameter_config[(int)ch].acc_mask = ui->receive_acc_mask_line_edit->text().remove("0x").toULong(&ok, 16);

    /* 设置工作模式 */

    can_alyst->parameter_config[(int)ch].mode = (can_alyst_ii::work_mode_t)ui->receive_mode_combo_box->currentIndex();

    /* 设置滤波模式 */

    can_alyst->parameter_config[(int)ch].filter = ((ui->receive_filter_combo_box->currentIndex()) > 0) ? ((can_alyst_ii::filter_t)((ui->receive_filter_combo_box->currentIndex()) - 1)) : \
                                                                                                         ((can_alyst_ii::filter_t)(ui->receive_filter_combo_box->currentIndex()));

    /* 获取 CAN ID */

    can_alyst->parameter_config[(int)ch].id = ui->transmit_id_line_edit->text().remove("0x").toInt(&ok, 16);

    /* 获取 CAN ID 类型 */

    can_alyst->parameter_config[(int)ch].id_type = (can_alyst_ii::id_type_t)ui->transmit_id_typde_combo_box->currentIndex();

    /* 获取帧类型 */

    can_alyst->parameter_config[int(ch)].frame_type = (can_alyst_ii::frame_type_t)ui->transmit_frame_type_combo_box->currentIndex();

    /* 获取发送方式 */

    can_alyst->parameter_config[int(ch)].send_type = (can_alyst_ii::send_type_t)ui->transmit_send_type_combo_box->currentIndex();

}

void MainWindow::can_parameter_config_base_clicked(void)
{
    can_alyst_ii::channel_t ch;

    /* 获取通道编号 */

    ch = (can_alyst_ii::channel_t)ui->receive_channel_combo_box->currentIndex();

    /* 设置工作模式 */

    can_alyst->parameter_config[(int)ch].mode = can_alyst_ii::work_mode_normal;

    ui->receive_mode_combo_box->setCurrentIndex(0);

    /* 设置波特率 */

    can_alyst->parameter_config[(int)ch].baudrate = "500";

    ui->receive_baudrate_combo_box->setCurrentIndex(10);

    /* 设置滤波模式 */

    can_alyst->parameter_config[(int)ch].filter = can_alyst_ii::filter_all;

    ui->receive_filter_combo_box->setCurrentIndex(0);

    /* 设置 CAN ID */

    can_alyst->parameter_config[(int)ch].id = 0x01;

    ui->transmit_id_line_edit->setText("0x01");

    /* 标准帧 */

    can_alyst->parameter_config[(int)ch].id_type = can_alyst_ii::id_std;

    ui->transmit_frame_type_combo_box->setCurrentIndex(0);

    /* 数据帧 */

    can_alyst->parameter_config[int(ch)].frame_type = can_alyst_ii::frame_data;

    ui->transmit_frame_type_combo_box->setCurrentIndex(0);

    /* 正常发送 */

    can_alyst->parameter_config[int(ch)].send_type = can_alyst_ii::send_normal;

    ui->transmit_send_type_combo_box->setCurrentIndex(0);

    /* 掩码参数变量恢复默认 */

    can_alyst->parameter_config[(int)ch].acc_code = 0x00000000;
    can_alyst->parameter_config[(int)ch].acc_mask = 0xFFFFFFFF;

    /* 掩码文本框恢复默认 */

    ui->receive_acc_code_line_edit->setText("0x00000000");
    ui->receive_acc_mask_line_edit->setText("0xFFFFFFFF");

    /* 掩码标准帧勾选框恢复默认 */

    ui->receive_acc_code_std_bit0_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_std_bit1_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_std_bit2_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_std_bit3_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_std_bit4_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_std_bit5_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_std_bit6_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_std_bit7_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_std_bit8_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_std_bit9_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_std_bit10_check_box->setCheckState(Qt::Unchecked);

    ui->receive_acc_mask_std_bit0_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_std_bit1_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_std_bit2_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_std_bit3_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_std_bit4_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_std_bit5_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_std_bit6_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_std_bit7_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_std_bit8_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_std_bit9_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_std_bit10_check_box->setCheckState(Qt::Checked);

    /* 掩码扩展勾选框恢复默认 */

    ui->receive_acc_code_ext_bit0_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit1_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit2_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit3_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit4_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit5_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit6_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit7_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit8_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit9_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit10_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit11_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit12_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit13_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit14_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit15_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit16_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit17_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit18_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit19_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit20_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit21_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit22_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit23_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit24_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit25_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit26_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit27_check_box->setCheckState(Qt::Unchecked);
    ui->receive_acc_code_ext_bit28_check_box->setCheckState(Qt::Unchecked);

    ui->receive_acc_mask_ext_bit0_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit1_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit2_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit3_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit4_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit5_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit6_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit7_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit8_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit9_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit10_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit11_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit12_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit13_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit14_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit15_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit16_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit17_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit18_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit19_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit20_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit21_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit22_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit23_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit24_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit25_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit26_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit27_check_box->setCheckState(Qt::Checked);
    ui->receive_acc_mask_ext_bit28_check_box->setCheckState(Qt::Checked);

    /* 选择框恢复默认 */

    ui->receive_write_radio_button->setChecked(false);
    ui->receive_std_radio_button->setChecked(true);
    ui->receive_ext_radio_button->setChecked(false);

}

void MainWindow::can_receive_select_clicked(void)
{
    bool receive_write_status;
    bool receive_std_status;
    bool receive_ext_status;

    if(ui->receive_write_radio_button->isChecked())
    {
        /* 手动输入被选中 */

        receive_write_status = true;
        receive_std_status = false;
        receive_ext_status = false;
    }
    else if(ui->receive_std_radio_button->isChecked())
    {
        /* 标准帧编辑被选中 */

        receive_write_status = false;
        receive_std_status = true;
        receive_ext_status = false;
    }
    else if(ui->receive_ext_radio_button->isChecked())
    {
        /* 扩展帧编辑被选中 */

        receive_write_status = false;
        receive_std_status = false;
        receive_ext_status = true;
    }
    else
    {
        receive_write_status = false;
        receive_std_status = true;
        receive_ext_status = false;
    }

    /* 手动输入勾选框 */

    ui->receive_acc_code_line_edit->setEnabled(receive_write_status);
    ui->receive_acc_mask_line_edit->setEnabled(receive_write_status);

    /* 标准帧勾选框 */

    ui->receive_acc_code_std_bit0_check_box->setEnabled(receive_std_status);
    ui->receive_acc_code_std_bit1_check_box->setEnabled(receive_std_status);
    ui->receive_acc_code_std_bit2_check_box->setEnabled(receive_std_status);
    ui->receive_acc_code_std_bit3_check_box->setEnabled(receive_std_status);
    ui->receive_acc_code_std_bit4_check_box->setEnabled(receive_std_status);
    ui->receive_acc_code_std_bit5_check_box->setEnabled(receive_std_status);
    ui->receive_acc_code_std_bit6_check_box->setEnabled(receive_std_status);
    ui->receive_acc_code_std_bit7_check_box->setEnabled(receive_std_status);
    ui->receive_acc_code_std_bit8_check_box->setEnabled(receive_std_status);
    ui->receive_acc_code_std_bit9_check_box->setEnabled(receive_std_status);
    ui->receive_acc_code_std_bit10_check_box->setEnabled(receive_std_status);

    ui->receive_acc_mask_std_bit0_check_box->setEnabled(receive_std_status);
    ui->receive_acc_mask_std_bit1_check_box->setEnabled(receive_std_status);
    ui->receive_acc_mask_std_bit2_check_box->setEnabled(receive_std_status);
    ui->receive_acc_mask_std_bit3_check_box->setEnabled(receive_std_status);
    ui->receive_acc_mask_std_bit4_check_box->setEnabled(receive_std_status);
    ui->receive_acc_mask_std_bit5_check_box->setEnabled(receive_std_status);
    ui->receive_acc_mask_std_bit6_check_box->setEnabled(receive_std_status);
    ui->receive_acc_mask_std_bit7_check_box->setEnabled(receive_std_status);
    ui->receive_acc_mask_std_bit8_check_box->setEnabled(receive_std_status);
    ui->receive_acc_mask_std_bit9_check_box->setEnabled(receive_std_status);
    ui->receive_acc_mask_std_bit10_check_box->setEnabled(receive_std_status);

    /* 扩展帧勾选框 */

    ui->receive_acc_code_ext_bit0_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit1_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit2_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit3_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit4_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit5_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit6_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit7_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit8_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit9_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit10_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit11_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit12_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit13_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit14_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit15_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit16_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit17_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit18_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit19_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit20_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit21_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit22_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit23_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit24_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit25_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit26_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit27_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_code_ext_bit28_check_box->setEnabled(receive_ext_status);

    ui->receive_acc_mask_ext_bit0_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit1_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit2_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit3_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit4_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit5_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit6_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit7_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit8_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit9_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit10_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit11_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit12_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit13_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit14_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit15_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit16_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit17_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit18_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit19_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit20_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit21_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit22_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit23_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit24_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit25_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit26_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit27_check_box->setEnabled(receive_ext_status);
    ui->receive_acc_mask_ext_bit28_check_box->setEnabled(receive_ext_status);
}

void MainWindow::can_receive_change_clicked(void)
{
    can_alyst_ii::channel_t ch;

    bool ok;

    ulong acc_code = 0;
    ulong acc_mask = 0;

    /* 获取通道编号 */

    ch = (can_alyst_ii::channel_t)ui->receive_channel_combo_box->currentIndex();

    if(ui->receive_write_radio_button->isChecked())
    {
        /* 手动输入被选中 */

        acc_code = ui->receive_acc_code_line_edit->text().remove("0x").toULong(&ok, 16);
        acc_mask = ui->receive_acc_mask_line_edit->text().remove("0x").toULong(&ok, 16);

        ui->receive_acc_code_std_bit0_check_box->setCheckState(((acc_code >> (21 + 0)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit1_check_box->setCheckState(((acc_code >> (21 + 1)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit2_check_box->setCheckState(((acc_code >> (21 + 2)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit3_check_box->setCheckState(((acc_code >> (21 + 3)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit4_check_box->setCheckState(((acc_code >> (21 + 4)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit5_check_box->setCheckState(((acc_code >> (21 + 5)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit6_check_box->setCheckState(((acc_code >> (21 + 6)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit7_check_box->setCheckState(((acc_code >> (21 + 7)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit8_check_box->setCheckState(((acc_code >> (21 + 8)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit9_check_box->setCheckState(((acc_code >> (21 + 9)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit10_check_box->setCheckState(((acc_code >> (21 + 10)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);

        ui->receive_acc_mask_std_bit0_check_box->setCheckState(((acc_mask >> (21 + 0)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit1_check_box->setCheckState(((acc_mask >> (21 + 1)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit2_check_box->setCheckState(((acc_mask >> (21 + 2)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit3_check_box->setCheckState(((acc_mask >> (21 + 3)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit4_check_box->setCheckState(((acc_mask >> (21 + 4)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit5_check_box->setCheckState(((acc_mask >> (21 + 5)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit6_check_box->setCheckState(((acc_mask >> (21 + 6)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit7_check_box->setCheckState(((acc_mask >> (21 + 7)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit8_check_box->setCheckState(((acc_mask >> (21 + 8)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit9_check_box->setCheckState(((acc_mask >> (21 + 9)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit10_check_box->setCheckState(((acc_mask >> (21 + 10)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);

        ui->receive_acc_code_ext_bit0_check_box->setCheckState(((acc_code >> (3 + 0)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit1_check_box->setCheckState(((acc_code >> (3 + 1)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit2_check_box->setCheckState(((acc_code >> (3 + 2)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit3_check_box->setCheckState(((acc_code >> (3 + 3)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit4_check_box->setCheckState(((acc_code >> (3 + 4)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit5_check_box->setCheckState(((acc_code >> (3 + 5)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit6_check_box->setCheckState(((acc_code >> (3 + 6)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit7_check_box->setCheckState(((acc_code >> (3 + 7)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit8_check_box->setCheckState(((acc_code >> (3 + 8)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit9_check_box->setCheckState(((acc_code >> (3 + 9)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit10_check_box->setCheckState(((acc_code >> (3 + 10)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit11_check_box->setCheckState(((acc_code >> (3 + 11)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit12_check_box->setCheckState(((acc_code >> (3 + 12)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit13_check_box->setCheckState(((acc_code >> (3 + 13)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit14_check_box->setCheckState(((acc_code >> (3 + 14)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit15_check_box->setCheckState(((acc_code >> (3 + 15)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit16_check_box->setCheckState(((acc_code >> (3 + 16)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit17_check_box->setCheckState(((acc_code >> (3 + 17)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit18_check_box->setCheckState(((acc_code >> (3 + 18)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit19_check_box->setCheckState(((acc_code >> (3 + 19)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit20_check_box->setCheckState(((acc_code >> (3 + 20)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit21_check_box->setCheckState(((acc_code >> (3 + 21)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit22_check_box->setCheckState(((acc_code >> (3 + 22)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit23_check_box->setCheckState(((acc_code >> (3 + 23)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit24_check_box->setCheckState(((acc_code >> (3 + 24)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit25_check_box->setCheckState(((acc_code >> (3 + 25)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit26_check_box->setCheckState(((acc_code >> (3 + 26)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit27_check_box->setCheckState(((acc_code >> (3 + 27)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit28_check_box->setCheckState(((acc_code >> (3 + 28)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);

        ui->receive_acc_mask_ext_bit0_check_box->setCheckState(((acc_mask >> (3 + 0)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit1_check_box->setCheckState(((acc_mask >> (3 + 1)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit2_check_box->setCheckState(((acc_mask >> (3 + 2)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit3_check_box->setCheckState(((acc_mask >> (3 + 3)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit4_check_box->setCheckState(((acc_mask >> (3 + 4)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit5_check_box->setCheckState(((acc_mask >> (3 + 5)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit6_check_box->setCheckState(((acc_mask >> (3 + 6)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit7_check_box->setCheckState(((acc_mask >> (3 + 7)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit8_check_box->setCheckState(((acc_mask >> (3 + 8)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit9_check_box->setCheckState(((acc_mask >> (3 + 9)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit10_check_box->setCheckState(((acc_mask >> (3 + 10)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit11_check_box->setCheckState(((acc_mask >> (3 + 11)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit12_check_box->setCheckState(((acc_mask >> (3 + 12)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit13_check_box->setCheckState(((acc_mask >> (3 + 13)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit14_check_box->setCheckState(((acc_mask >> (3 + 14)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit15_check_box->setCheckState(((acc_mask >> (3 + 15)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit16_check_box->setCheckState(((acc_mask >> (3 + 16)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit17_check_box->setCheckState(((acc_mask >> (3 + 17)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit18_check_box->setCheckState(((acc_mask >> (3 + 18)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit19_check_box->setCheckState(((acc_mask >> (3 + 19)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit20_check_box->setCheckState(((acc_mask >> (3 + 20)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit21_check_box->setCheckState(((acc_mask >> (3 + 21)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit22_check_box->setCheckState(((acc_mask >> (3 + 22)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit23_check_box->setCheckState(((acc_mask >> (3 + 23)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit24_check_box->setCheckState(((acc_mask >> (3 + 24)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit25_check_box->setCheckState(((acc_mask >> (3 + 25)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit26_check_box->setCheckState(((acc_mask >> (3 + 26)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit27_check_box->setCheckState(((acc_mask >> (3 + 27)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit28_check_box->setCheckState(((acc_mask >> (3 + 28)) & 0x01) == 0x00 ? Qt::Unchecked : Qt::Checked);

        can_alyst->parameter_config[(int)ch].acc_code = acc_code;
        can_alyst->parameter_config[(int)ch].acc_mask = acc_mask;
    }
    else if(ui->receive_std_radio_button->isChecked())
    {
        /* 标准帧编辑被选中 */

        acc_code = acc_code | (((uchar)ui->receive_acc_code_std_bit0_check_box->isChecked()) << 0);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_std_bit1_check_box->isChecked()) << 1);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_std_bit2_check_box->isChecked()) << 2);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_std_bit3_check_box->isChecked()) << 3);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_std_bit4_check_box->isChecked()) << 4);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_std_bit5_check_box->isChecked()) << 5);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_std_bit6_check_box->isChecked()) << 6);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_std_bit7_check_box->isChecked()) << 7);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_std_bit8_check_box->isChecked()) << 8);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_std_bit9_check_box->isChecked()) << 9);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_std_bit10_check_box->isChecked()) << 10);
        acc_code = acc_code << 21;
        acc_code = acc_code & 0xFFE00000;

        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_std_bit0_check_box->isChecked()) << 0);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_std_bit1_check_box->isChecked()) << 1);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_std_bit2_check_box->isChecked()) << 2);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_std_bit3_check_box->isChecked()) << 3);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_std_bit4_check_box->isChecked()) << 4);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_std_bit5_check_box->isChecked()) << 5);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_std_bit6_check_box->isChecked()) << 6);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_std_bit7_check_box->isChecked()) << 7);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_std_bit8_check_box->isChecked()) << 8);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_std_bit9_check_box->isChecked()) << 9);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_std_bit10_check_box->isChecked()) << 10);
        acc_mask = acc_mask << 21;
        acc_mask = acc_mask | 0x001FFFFF;

        ui->receive_acc_code_ext_bit0_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit1_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit2_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit3_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit4_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit5_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit6_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit7_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit8_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit9_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit10_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit11_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit12_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit13_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit14_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit15_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit16_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit17_check_box->setCheckState(Qt::Unchecked);
        ui->receive_acc_code_ext_bit18_check_box->setCheckState(ui->receive_acc_code_std_bit0_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit19_check_box->setCheckState(ui->receive_acc_code_std_bit1_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit20_check_box->setCheckState(ui->receive_acc_code_std_bit2_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit21_check_box->setCheckState(ui->receive_acc_code_std_bit3_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit22_check_box->setCheckState(ui->receive_acc_code_std_bit4_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit23_check_box->setCheckState(ui->receive_acc_code_std_bit5_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit24_check_box->setCheckState(ui->receive_acc_code_std_bit6_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit25_check_box->setCheckState(ui->receive_acc_code_std_bit7_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit26_check_box->setCheckState(ui->receive_acc_code_std_bit8_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit27_check_box->setCheckState(ui->receive_acc_code_std_bit9_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_ext_bit28_check_box->setCheckState(ui->receive_acc_code_std_bit10_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);

        ui->receive_acc_mask_ext_bit0_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit1_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit2_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit3_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit4_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit5_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit6_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit7_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit8_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit9_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit10_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit11_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit12_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit13_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit14_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit15_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit16_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit17_check_box->setCheckState(Qt::Checked);
        ui->receive_acc_mask_ext_bit18_check_box->setCheckState(ui->receive_acc_mask_std_bit0_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit19_check_box->setCheckState(ui->receive_acc_mask_std_bit1_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit20_check_box->setCheckState(ui->receive_acc_mask_std_bit2_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit21_check_box->setCheckState(ui->receive_acc_mask_std_bit3_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit22_check_box->setCheckState(ui->receive_acc_mask_std_bit4_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit23_check_box->setCheckState(ui->receive_acc_mask_std_bit5_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit24_check_box->setCheckState(ui->receive_acc_mask_std_bit6_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit25_check_box->setCheckState(ui->receive_acc_mask_std_bit7_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit26_check_box->setCheckState(ui->receive_acc_mask_std_bit8_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit27_check_box->setCheckState(ui->receive_acc_mask_std_bit9_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_ext_bit28_check_box->setCheckState(ui->receive_acc_mask_std_bit10_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);

        ui->receive_acc_code_line_edit->setText("0x" + QString("%1").arg(acc_code, 8, 16, QLatin1Char('0')).toUpper());
        ui->receive_acc_mask_line_edit->setText("0x" + QString("%1").arg(acc_mask, 8, 16, QLatin1Char('0')).toUpper());

        can_alyst->parameter_config[(int)ch].acc_code = acc_code;
        can_alyst->parameter_config[(int)ch].acc_mask = acc_mask;

    }
    else if(ui->receive_ext_radio_button->isChecked())
    {
        /* 扩展帧编辑被选中 */

        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit0_check_box->isChecked()) << 0);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit1_check_box->isChecked()) << 1);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit2_check_box->isChecked()) << 2);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit3_check_box->isChecked()) << 3);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit4_check_box->isChecked()) << 4);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit5_check_box->isChecked()) << 5);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit6_check_box->isChecked()) << 6);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit7_check_box->isChecked()) << 7);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit8_check_box->isChecked()) << 8);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit9_check_box->isChecked()) << 9);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit10_check_box->isChecked()) << 10);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit11_check_box->isChecked()) << 11);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit12_check_box->isChecked()) << 12);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit13_check_box->isChecked()) << 13);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit14_check_box->isChecked()) << 14);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit15_check_box->isChecked()) << 15);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit16_check_box->isChecked()) << 16);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit17_check_box->isChecked()) << 17);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit18_check_box->isChecked()) << 18);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit19_check_box->isChecked()) << 19);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit20_check_box->isChecked()) << 20);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit21_check_box->isChecked()) << 21);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit22_check_box->isChecked()) << 22);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit23_check_box->isChecked()) << 23);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit24_check_box->isChecked()) << 24);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit25_check_box->isChecked()) << 25);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit26_check_box->isChecked()) << 26);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit27_check_box->isChecked()) << 27);
        acc_code = acc_code | (((uchar)ui->receive_acc_code_ext_bit28_check_box->isChecked()) << 28);
        acc_code = acc_code << 3;
        acc_code = acc_code & 0xFFFFFFF8;

        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit0_check_box->isChecked()) << 0);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit1_check_box->isChecked()) << 1);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit2_check_box->isChecked()) << 2);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit3_check_box->isChecked()) << 3);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit4_check_box->isChecked()) << 4);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit5_check_box->isChecked()) << 5);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit6_check_box->isChecked()) << 6);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit7_check_box->isChecked()) << 7);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit8_check_box->isChecked()) << 8);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit9_check_box->isChecked()) << 9);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit10_check_box->isChecked()) << 10);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit11_check_box->isChecked()) << 11);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit12_check_box->isChecked()) << 12);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit13_check_box->isChecked()) << 13);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit14_check_box->isChecked()) << 14);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit15_check_box->isChecked()) << 15);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit16_check_box->isChecked()) << 16);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit17_check_box->isChecked()) << 17);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit18_check_box->isChecked()) << 18);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit19_check_box->isChecked()) << 19);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit20_check_box->isChecked()) << 20);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit21_check_box->isChecked()) << 21);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit22_check_box->isChecked()) << 22);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit23_check_box->isChecked()) << 23);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit24_check_box->isChecked()) << 24);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit25_check_box->isChecked()) << 25);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit26_check_box->isChecked()) << 26);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit27_check_box->isChecked()) << 27);
        acc_mask = acc_mask | (((uchar)ui->receive_acc_mask_ext_bit28_check_box->isChecked()) << 28);
        acc_mask = acc_mask << 3;
        acc_mask = acc_mask | 0x00000007;

        ui->receive_acc_code_std_bit0_check_box->setCheckState(ui->receive_acc_code_ext_bit18_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit1_check_box->setCheckState(ui->receive_acc_code_ext_bit19_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit2_check_box->setCheckState(ui->receive_acc_code_ext_bit20_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit3_check_box->setCheckState(ui->receive_acc_code_ext_bit21_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit4_check_box->setCheckState(ui->receive_acc_code_ext_bit22_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit5_check_box->setCheckState(ui->receive_acc_code_ext_bit23_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit6_check_box->setCheckState(ui->receive_acc_code_ext_bit24_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit7_check_box->setCheckState(ui->receive_acc_code_ext_bit25_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit8_check_box->setCheckState(ui->receive_acc_code_ext_bit26_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit9_check_box->setCheckState(ui->receive_acc_code_ext_bit27_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_code_std_bit10_check_box->setCheckState(ui->receive_acc_code_ext_bit28_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);

        ui->receive_acc_mask_std_bit0_check_box->setCheckState(ui->receive_acc_mask_ext_bit18_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit1_check_box->setCheckState(ui->receive_acc_mask_ext_bit19_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit2_check_box->setCheckState(ui->receive_acc_mask_ext_bit20_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit3_check_box->setCheckState(ui->receive_acc_mask_ext_bit21_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit4_check_box->setCheckState(ui->receive_acc_mask_ext_bit22_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit5_check_box->setCheckState(ui->receive_acc_mask_ext_bit23_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit6_check_box->setCheckState(ui->receive_acc_mask_ext_bit24_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit7_check_box->setCheckState(ui->receive_acc_mask_ext_bit25_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit8_check_box->setCheckState(ui->receive_acc_mask_ext_bit26_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit9_check_box->setCheckState(ui->receive_acc_mask_ext_bit27_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);
        ui->receive_acc_mask_std_bit10_check_box->setCheckState(ui->receive_acc_mask_ext_bit28_check_box->isChecked() == false ? Qt::Unchecked : Qt::Checked);

        ui->receive_acc_code_line_edit->setText("0x" + QString("%1").arg(acc_code, 8, 16, QLatin1Char('0')).toUpper());
        ui->receive_acc_mask_line_edit->setText("0x" + QString("%1").arg(acc_mask, 8, 16, QLatin1Char('0')).toUpper());

        can_alyst->parameter_config[(int)ch].acc_code = acc_code;
        can_alyst->parameter_config[(int)ch].acc_mask = acc_mask;

    }
}

void MainWindow::can_transmit_clicked(void)
{
    can_alyst_ii::can_alyst_ii::channel_t ch;

    uchar buf[8];

    /* 获取通道编号 */

    ch = (can_alyst_ii::can_alyst_ii::channel_t)ui->write_channel_combo_box->currentIndex();

    buf[0] = 0x01;
    buf[1] = 0x02;
    buf[2] = 0x03;
    buf[3] = 0x04;
    buf[4] = 0x04;
    buf[5] = 0x03;
    buf[6] = 0x02;
    buf[7] = 0x01;

    can_alyst->transmit(ch, buf, 8);
}

void MainWindow::can_receive_ch1_msg_process(VCI_CAN_OBJ *ch1_dat_buf, ulong ch1_dat_num)
{
    for(int loop = 0; loop < (int)ch1_dat_num; loop++)
    {
        for(int loop_data = 0; loop_data < 8; loop_data++)
        {
            qDebug() << ch1_dat_buf[loop].Data[loop_data];
        }
    }
}

void MainWindow::can_receive_ch2_msg_process(VCI_CAN_OBJ *ch2_dat_buf, ulong ch2_dat_num)
{
    for(int loop = 0; loop < (int)ch2_dat_num; loop++)
    {
        for(int loop_data = 0; loop_data < 8; loop_data++)
        {
            qDebug() << ch2_dat_buf[loop].Data[loop_data];
        }
    }
}
